<?php include_once('header.php');?>
<div class="main-content">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
			<ul class="breadcrumb">
				<li>
					<i class="icon-home home-icon"></i>
					报价管理
				</li>
				<li>
					申请报价列表
				</li>
			</ul>
		</div>	
		<div class="page-content">
			<div class="page-header">
				<h1 class="blue"><i class="icon-edit"></i> 申请报价列表</h1>
			</div>										
			<div class="alert alert-block alert-success">
				<button type="button" class="close" data-dismiss="alert">
					<i class="icon-remove"></i>
				</button>
				<i class="icon-comment-alt"></i> 尊敬的管理员您好，修改了会员的报价后请及时修改后台给会员的投保信息！
			</div>
			<div class="visible-md visible-lg hidden-sm hidden-xs btn-group" style="margin-bottom:20px;">
				<form  action="/www/quote/quote_list" method="post">
				<label style="padding-left:10px;font-size:13px;">车主姓名：</label>
					<input  type="text" id="vehicle_owner" name="vehicle_owner" value="<?php echo $vehicle_owner;?>"/>	
				<label style="padding-left:10px;font-size:13px;">车牌号：</label>
					<input  type="text" id="car_num" name="car_num" value="<?php echo $car_num;?>"/>			
				<a style="padding-left:10px;" id="search">
					<button type="submit" class="btn btn-xs btn-success" style="height:28px;">
						<i class="icon-search nav-search-icon"></i>搜索
					</button>
				</a>
				</form>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="table-header">
						申请报价信息列表
					</div>
					<div class="table-responsive">
						<table id="sample-table-2" class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>id</th>
									<th>车主姓名</th>
									<th>微信昵称</th>
									<th>联系方式</th>
									<th>车型号</th>
									<th>车牌号</th>
									<th>发动机</th>
									<th>车架号</th>
									<th>上季报价单位</th>
									<th>报价时间</th>
									<th>操作</th>
								</tr>
							</thead>
							<tfoot>
								<tr>
									<th>id</th>
									<th>车主姓名</th>
									<th>微信昵称</th>
									<th>联系方式</th>
									<th>车型号</th>
									<th>车牌号</th>
									<th>发动机</th>
									<th>车架号</th>
									<th>上季报价单位</th>
									<th>报价时间</th>
									<th>操作</th>
								</tr>					
							</tfoot>
						</table>
					</div><!-- /.table-responsive -->
				</div><!-- /span -->
			</div>
		</div>														
	</div>
<?php include_once('content.php');?>
	<script src="/public_source/www/assets/js/jquery.dataTables.min.js"></script>
	<script src="/public_source/www/assets/js/jquery.dataTables.bootstrap.js"></script>
	<link  rel="stylesheet" href="/public_source/www/css/insure.css" />
<?php include_once('footer.php');?>	
<script type="text/javascript">
	jQuery(function($) {
		var vehicle_owner = $("#vehicle_owner").val(); 
		var car_num = $("#car_num").val(); 
		var oTable1 = $('#sample-table-2').dataTable({ 
	        "oLanguage": {
	                "sUrl": "/public_source/www/assets/language/zh_CN.json"
	         },			     	
			"aaSorting": [[ 0, "asc" ]],
			"bAutoWidth": false, 
			"bProcessing": true, //开启读取服务器数据时显示正在加载中……特别是大数据量的时候，开启此功能比较好
            "bServerSide": true, //开启服务器模式，使用服务器端处理配置datatable。注意：sAjaxSource参数也必须被给予为了给datatable源代码来获取所需的数据对于每个画。 这个翻译有点别扭。开启此模式后，你对datatables的每个操作 每页显示多少条记录、下一页、上一页、排序（表头）、搜索，这些都会传给服务器相应的值。 
            "sAjaxSource": "/www/quote/ajax_quote_list?vehicle_owner="+vehicle_owner+"&car_num="+car_num, //给服务器发请求的url
            "aoColumns": [ //这个属性下的设置会应用到所有列，按顺序没有是空
                {"mData": 'id'}, //mData 表示发请求时候本列的列明，返回的数据中相同下标名字的数据会填充到这一列
                {"mData": 'vehicle_owner'},
                {"mData": 'user_nick'},
                {"mData": 'phone'},
                {"mData": 'vehicle_model'},
                {"mData": 'car_num'},
                {"mData": 'engine'},
                {"mData": 'frame_num'},
                {"mData": 'company_name'},
                {"mData": 'quote_time'},
                {"mData": 'operate'},
            ],
            "aoColumnDefs": [//和aoColums类似，但他可以给指定列附近爱属性
               {"bSortable": false, "aTargets": [0,10]},//这句话意思是第1,3,6,7,8,9列（从0开始算） 不能排序
        	],
            "fnCreatedRow": function(nRow, aData,iDataIndex) {
                $('td:eq(0)',nRow).html("<span class='row-details row-details-close' data_id='" + aData.id + "'></span>&nbsp;" + aData.id);
            },
         	"fnInitComplete": function(oSettings, json) { //回调函数
           	} 
		});				
		$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
	    $('.table').on('click','tbody td .row-details',function() {
	    	var nTr = $(this).parents('tr')[0];
	       	if (oTable1.fnIsOpen(nTr)) //判断是否已打开
            {
                 /* This row is already open - close it */
                 $(this).addClass("row-details-close").removeClass("row-details-open");
                 oTable1.fnClose(nTr);
             } else {
                 /* Open this row */
                 $(this).addClass("row-details-open").removeClass("row-details-close");
                 //  alert($(this).attr("data_id"));
                 //oTable.fnOpen( nTr,
                 // 调用方法显示详细信息 data_id为自定义属性 存放配置ID
                 fnFormatDetails(nTr, $(this).attr("data_id"));
            }
	    });
	   function fnFormatDetails(nTr, pdataId) {
	       //根据配置Id 异步查询数据
	       $.get("/www/quote/ajax_user_quote/"+ pdataId,function(json) {
		       	var json = eval("("+json+")");
				var sOut = json.str;
	             oTable1.fnOpen(nTr,sOut,'details');	          	
	      });	 
	   	}
		function tooltip_placement(context, source) {
			var $source = $(source);
			var $parent = $source.closest('table')
			var off1 = $parent.offset();
			var w1 = $parent.width();	
			var off2 = $source.offset();
			var w2 = $source.width();
			if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
			return 'left';
		}
	});
</script>
<style>
	#sample-table-2_filter {
		display:none;
	}
</style>
